
<!--page start-->
<div class="page-content">
    <div class="container-fluid">
        <!--pageHeader start-->
        <div class="row-fluid titleBox">
            <h3 class="page-title pull-left">管理员信息</h3>
            <!--breadcrumb start-->
            <ul class="breadcrumb pull-right">
                <li>
                    <i class="icon-circle-arrow-left"></i>
                    <span>管理中心</span>
                    <i class="icon-angle-right"></i>
                </li>
                <li><a href="#">管理员管理</a></li>
            </ul>
            <!--breadcrumb over-->
        </div>
        <!--pageHeader over-->
        <!--container start-->
        <div class="row-fluid">
            <!--left start-->
            <div class="span12">
                <div class="portlet box blue">
                    <div class="portlet-title">
                        <div class="caption"><i class="icon-file-text"></i>基本信息</div>
                        <div class="tools">
                            <a href="javascript:;" class="collapse"></a>
                            <a href="#portlet-config" data-toggle="modal" class="config"></a>
                            <a href="javascript:;" class="reload"></a>
                        </div>
                    </div>
                    <div class="portlet-body form">
                     <form action="<?php echo base_url();?>/admin/admin/update/<?=$user['id']?>" method="post"class="form-horizontal form-row-seperated" id="formSubmit" novalidate="novalidate">
                         <div class="control-group">
                            <label class="control-label">管理员账号</label>
                            <div class="controls">
                                <input type="text" name="admin[user_name]" value="<?=$admin['user_name']?>" class="m-wrap span8"/>
                                <span class="help-inline" style="display: none;">This is inline help</span>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">管理员密码</label>
                            <div class="controls">
                                <input type="text" name="admin[user_password]" value="<?=$admin['user_password']?>" class="m-wrap span8"/>
                                <span class="help-inline" style="display: none;">This is inline help</span>
                            </div>
                        </div>
                        <!-- <div class="control-group">
                            <label class="control-label">所属部门</label>
                            <div class="controls">
                                <select name="user[dept_id]" id=""  >
                                <?php foreach($dept_list as $v): ?>
                                    
                                    <option value="<?php echo $v['dept_id'] ?>" <?php echo $v['dept_id']==$user['dept_id']?"selected":"";?> >
                                        <?php echo $v['dept_name'] ?> 
                                    </option>

                                <?php endforeach; ?>
                                </select>
                            </div>
                        </div> -->
                        <div class="control-group">
                            <label class="control-label">角色</label>
                            <div class="controls">
                                <select name="user[user_role]" id="">
                       
                                    <option value="1" <?php echo $user['user_role']==1?"selected":""; ?> >超级管理员</option>
                                    <option value="2" <?php echo $user['user_role']==2?"selected":""; ?> >普通员工</option>

                       
                                </select>
                            </div>
                        </div>
                        
                        <div class="form-actions">
                            <button type="button" class="btn" onclick="javascript:history.go(-1);">取消</button>
                            <button type="submit" class="btn blue" name="submit" ><i class="icon-ok"></i> 保存</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        <!--left over-->
    </div>
    <!--container over-->
</div>
</div>
<!--page over-->

<script type="text/javascript">
    jQuery(document).ready(function() {
    /*验证
	required: "必选字段",  
	remote: "请修正该字段",  
	email: "请输入正确格式的电子邮件",  
	url: "请输入合法的网址",  
	date: "请输入合法的日期",  
	dateISO: "请输入合法的日期 (ISO).",  
	number: "请输入合法的数字",  
	digits: "只能输入整数",  
	creditcard: "请输入合法的信用卡号",  
	equalTo: "请再次输入相同的值",  
	accept: "请输入拥有合法后缀名的字符串",  
	maxlength: jQuery.validator.format("请输入一个 长度最多是 {0}的字符串"),  
	minlength: jQuery.validator.format("请输入一个 长度最少是 {0}的字符串"),  
	rangelength: jQuery.validator.format("请输入 一个长度介于 {0}和 {1}之间的字符串"),  
	range: jQuery.validator.format("请输入一个介于 {0}和 {1}之间的值"),  
	max: jQuery.validator.format("请输入一个最大为{0}的值"),  
	min: jQuery.validator.format("请输入一个最小为{0}的值")  
	*/
	var form1 = $('#formSubmit');
	form1.validate({
	    errorElement: 'span', //default input error message container
	    errorClass: 'help-inline', // default input error message class
	    focusInvalid: false, // do not focus the last invalid input
	    ignore: "",//忽略
	    rules: {
          "user[user_name]": {
           minlength: 2,
           required: true,
       },
       "user[user_password]": {
           minlength: 6,
           required: true,
       },
       "user[user_realname]": {
           minlength: 2,
           required: true,
       },
   },
	    invalidHandler: function (event, validator) { //验证不通过 头部显示           
         App.scrollTo(form1, -200);
     },
	    highlight: function (element,b,c) { //验证不通过 控件样式控制
         $(element).closest('.control-group').removeClass('success').addClass('error');
     },
     unhighlight: function (element) {
         $(element).closest('.control-group').removeClass('error').addClass('success');
     },
	    success: function (label) {//验证通过
	    	label.remove(); 
	    },
	    submitHandler: function (form) {
         form.submit();
     }
 });
});    
</script>
